package com.vca.common.response;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.vca.common.vo.PreOrderCommonVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 商品评论响应体
 */
@Data
public class StoreProductReplyResponse {
    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "评论ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "用户ID")
    private Integer uid;

    @ApiModelProperty(value = "订单ID")
    private Integer oid;

    @ApiModelProperty(value = "订单号")
    private String orderNo;

    @ApiModelProperty(value = "商品id")
    private Integer productId;

    @ApiModelProperty(value = "订单类型:0-课程订单 1=套课订单 2=讲座订单 3=展览订单 4=商品订单")
    private String replyType;

    @ApiModelProperty(value = "订单类型")
    private String orderType;

    @ApiModelProperty(value = "商品分数")
    private Integer productScore;

    @ApiModelProperty(value = "服务分数")
    private Integer serviceScore;

    @ApiModelProperty(value = "评论内容")
    private String comment;

    @ApiModelProperty(value = "评论图片")
    private List<String> pics;

    @ApiModelProperty(value = "管理员回复内容")
    private String merchantReplyContent;

    @ApiModelProperty(value = "管理员回复时间")
    private Integer merchantReplyTime;

    @ApiModelProperty(value = "0未删除1已删除")
    private Boolean isDel;

    @ApiModelProperty(value = "0未回复1已回复")
    private Boolean isReply;

    @ApiModelProperty(value = "用户名称")
    private String nickname;

    @ApiModelProperty(value = "用户头像")
    private String avatar;

    @ApiModelProperty(value = "评论时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "评论时间Str")
    private String createTimeStr;

    @ApiModelProperty(value = "更新时间Str")
    private String updateTimeStr;

    @ApiModelProperty(value = "商品规格属性值")
    private String sku;

    @ApiModelProperty(value = "商品信息")
    private List<PreOrderCommonVo.PreOrderProductDetail> preOrderProductDetails = new ArrayList<>();

    @ApiModelProperty(value = "课程/套课/讲座/展览信息")
    private PreOrderCommonVo.CourseInfoDetail courseInfoDetails ;

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
        if(createTime != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            setCreateTimeStr(sdf.format(createTime));
        }
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
        if(updateTime != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            setUpdateTimeStr(sdf.format(updateTime));
        }
    }

//    public void setPics(List<String> pics) {
//        this.pics = Arrays.asList(OssUtils.getOssFileUrl(String.join(",",pics)).split(","));
//    }
}
